package com.cainaer.product.controller;


import com.cainaer.product.service.ICommentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 评论表 前端控制器
 * </p>
 *
 * @author Tina
 * @since 2020-09-11
 */
@RestController
@RequestMapping("/comment/")
public class CommentController {
    private Logger logger = LoggerFactory.getLogger(CommentController.class);

    @Autowired
    private ICommentService commentService;
    /**
     * 通过商商品ID查询这个这个商品的平均评价级别
     *
     * @param productId 商品ID
     * @return
     */
    @GetMapping("selectCommentAvgLevelByProductId")
    public double selectCommentAvgLevelByProductId(@RequestParam("productId") Long productId){
        return commentService.selectCommentAvgLevelByProductId(productId);
    }

}
